//
//  ApplyInfoHeaderView.m
//  OneCreditTreasure
//
//  Created by iOS Tedu on 16/8/29.
//
//

#import "ApplyInfoHeaderView.h"

#define myOwnLBSettings(label)\
label.numberOfLines = 0;\
label.textAlignment = NSTextAlignmentCenter;\
label.font = [UIFont systemFontOfSize:14 * AUTO_WIDTH];\
label.layer.borderWidth = 1;\
label.layer.borderColor = [[UIColor lightGrayColor] CGColor];

@implementation ApplyInfoHeaderView
#pragma mark - 生命周期 life cycle
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self rightLB];
    }
    return self;
}

#pragma mark - 懒加载 lazy loading
- (UILabel *)leftLB {
    if(_leftLB == nil) {
        _leftLB = [[UILabel alloc] init];
        [self addSubview:_leftLB];
        [_leftLB mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(kScreenW / 8);
            make.top.equalTo(15 * AUTO_WIDTH);
            make.bottom.equalTo(-15 * AUTO_WIDTH);
            make.width.equalTo(kScreenW / 4);
        }];
        _leftLB.text = @"首付\n224100元";
        myOwnLBSettings(_leftLB);
    }
    return _leftLB;
}

- (UILabel *)centerLB {
    if(_centerLB == nil) {
        _centerLB = [[UILabel alloc] init];
        [self addSubview:_centerLB];
        [_centerLB mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.leftLB.mas_right).equalTo(0);
            make.top.equalTo(15 * AUTO_WIDTH);
            make.bottom.equalTo(-15 * AUTO_WIDTH);
            make.width.equalTo(kScreenW / 4);
        }];
        _centerLB.text = @"期数\n36期";
        myOwnLBSettings(_centerLB);
    }
    return _centerLB;
}

- (UILabel *)rightLB {
    if(_rightLB == nil) {
        UIView *lineView = [UIView new];
        lineView.backgroundColor = [UIColor lightGrayColor];
        [self addSubview:lineView];
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.equalTo(0);
            make.height.equalTo(1);
        }];

        _rightLB = [[UILabel alloc] init];
        [self addSubview:_rightLB];        [_rightLB mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.centerLB.mas_right).equalTo(0);
            make.top.equalTo(15 * AUTO_WIDTH);
            make.bottom.equalTo(-15 * AUTO_WIDTH);
            make.width.equalTo(kScreenW / 4);
        }];
        _rightLB.text = @"月供\n18080起";
        myOwnLBSettings(_rightLB);
    }
    return _rightLB;
}

@end
